"""
udp 客户端流程
"""
from socket import *

# 服务器地址
ADDR = ("172.40.0.97",8888)

# 创建udp套接字
udp_socket = socket(AF_INET,SOCK_DGRAM)


# 发送接收内容
while True:
    msg = input(">>")
    udp_socket.sendto(msg.encode(),ADDR) # bytes数据
    if msg == "##":
        break
    data,addr = udp_socket.recvfrom(1024)
    print("From server:",data.decode())

udp_socket.close()